package com.xydpeng.tech.common.pojo;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

/**
 * @author xydpeng
 * @version v1.0
 * @date: 2024/12/16
 * @description:
 */
public class ComPage<T> implements Serializable {

    /**
     * 总数
     */
    protected long total = 0;
    /**
     * 查询数据列表
     */
    protected List<T> records = Collections.emptyList();
    /**
     * 每页显示条数，默认 10
     */
    protected long size;

    /**
     * 当前页
     */
    protected long current;

    private ComPage() {
    }

    public ComPage(long total, List<T> records) {
        this.total = total;
        this.records = records;
    }

    public ComPage(long current, long size, List<T> records, long total) {
        this.size = size;
        this.current = current;
        this.total = total;
        this.records = records;
    }

    public static <T> ComPage<T> empty() {
        return new ComPage<>();
    }


}
